﻿<UserControl x:Class="SGTLightAccent.Views.Admin"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:behaviors="clr-namespace:SGTLightAccent.Models"
    DataContext="{Binding Main, Source={StaticResource Locator}}" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" d:DesignHeight="562" d:DesignWidth="774" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">
    
    <Grid x:Name="LayoutRoot" Background="White">
        <sdk:TabControl Name="tabControl1" TabStripPlacement="Top"  BorderThickness="1" >
            <sdk:TabItem Header="Clientes" Height="33" VerticalAlignment="Center" >
                <StackPanel>
                    <Border BorderBrush="Silver" BorderThickness="1" Height="108" HorizontalAlignment="Center" Margin="10,10,0,0" Name="borderDescagas" VerticalAlignment="Top" Width="534"  >
                        <Grid Background="White" HorizontalAlignment="Left" Width="533" Height="142" VerticalAlignment="Top">
                            <sdk:Label Content="Empresa" FontWeight="Bold" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="11,12,0,0" x:Name="labeld1" VerticalAlignment="Top" Width="62" />
                            <sdk:Label Content="Contacto" FontWeight="Bold" Height="28" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Margin="0,12,225,0" x:Name="labeld3" VerticalAlignment="Top" Width="67" />
                            <TextBox Height="28" HorizontalAlignment="Left" IsReadOnly="True" Margin="79,12,0,0" x:Name="textBoxd1" Text="{Binding Mode=TwoWay, Path=FiltroNroBarco}" VerticalAlignment="Top" Width="117" />
                            <TextBox Height="28" HorizontalAlignment="Right" Margin="0,12,37,0" x:Name="textBoxd3" Text="{Binding Mode=TwoWay, Path=FiltroProducto}" VerticalAlignment="Top" Width="180" />
                            <Button Command="{Binding Path=BotonBuscarClientes}" Content="Buscar" Height="33" Margin="0,53,8,0" x:Name="buttond2" Width="65" VerticalAlignment="Top" HorizontalAlignment="Right" RenderTransformOrigin="0.477,1" />
                            <CheckBox HorizontalAlignment="Center" Margin="202,14,306,104" Name="chkBarco" VerticalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" RenderTransformOrigin="0.6,0.5" IsChecked="{Binding Path=FiltroChkBarco, Mode=TwoWay}" />
                            <CheckBox HorizontalAlignment="Center" HorizontalContentAlignment="Center" Margin="498,14,10,104" Name="chkProducto" VerticalAlignment="Center" VerticalContentAlignment="Center" IsChecked="{Binding Path=FiltroChkProducto, Mode=TwoWay}" />
                        </Grid>
                    </Border>
                    <Grid Height="331" Name="grid1" Width="748" Margin="0,20,0,0">


                        <sdk:DataGrid AutoGenerateColumns="False" Margin="0,44,0,-37" ItemsSource="{Binding Path=Clientes}" Name="dataGrid2"  SelectionMode="Single" SelectedItem="{Binding Path=ClienteSeleccionado, Mode=TwoWay}">
                            <sdk:DataGrid.Columns>
                                <sdk:DataGridTextColumn Binding="{Binding Path=Nombre}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Empresa" Width="150" IsReadOnly="True" />
                                <sdk:DataGridTextColumn Binding="{Binding Path=Direccion}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Dirección" Width="170" IsReadOnly="True" />
                                <sdk:DataGridTextColumn Binding="{Binding Path=Contacto}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Contacto" Width="125*" IsReadOnly="True" />
                                <sdk:DataGridTextColumn Binding="{Binding Path=Telefono}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Telefono" Width="125*" IsReadOnly="True" />

                                <sdk:DataGridTextColumn Binding="{Binding Path=Usuario_FK}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Usuario" Width="110" IsReadOnly="True"/>

                            </sdk:DataGrid.Columns>
                            <i:Interaction.Behaviors>
                                <behaviors:DataGridDoubleClickBehavior
                                        DoubleClickCommand="{Binding Path=BotonActualizarCliente}" 
                                        CommandParameter="{Binding SelectedItem, ElementName=dataGrid2}"
                                      />

                            </i:Interaction.Behaviors>
                        </sdk:DataGrid>

                        <toolkit:BusyIndicator IsBusy="{Binding Path=EstaCargando}" DisplayAfter="0" BusyContent="Buscando descargas...">

                        </toolkit:BusyIndicator>
                        <Button Content="Nuevo" Height="38" HorizontalAlignment="Left" Name="button3" VerticalAlignment="Top" Width="65" Command="{Binding Path=BotonNuevoCliente}" />
                    </Grid>
                </StackPanel>
            </sdk:TabItem>
            <sdk:TabItem Header="Productos" Height="33" VerticalAlignment="Center" >
                <StackPanel Orientation="Vertical">
                    <Border BorderBrush="Silver" BorderThickness="1" Height="119" HorizontalAlignment="Center" Margin="10,10,0,0" Name="border1" VerticalAlignment="Top" Width="273" Background="{x:Null}">
                        <Grid Background="White">
                            <sdk:Label Content="Producto" FontWeight="Bold" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="10,12,0,0" Name="label1" VerticalAlignment="Top" Width="70" />
                            <TextBox Height="23" HorizontalAlignment="Left" Margin="78,10,0,0" Name="textBox1" VerticalAlignment="Top" Width="165" />
                            <Button Command="{Binding Path=BotonBuscarProducto}" Content="Buscar" Height="33" Margin="0,56,27,0" Name="button2" VerticalAlignment="Top" HorizontalAlignment="Right" Width="74" />
                        </Grid>
                    </Border>
                    <Grid Width="300" Margin="20,20,0,0" Height="358">
                    <sdk:DataGrid AutoGenerateColumns="False" Margin="0,49,0,0" Name="dataGrid1" ItemsSource="{Binding Path=Productos}" SelectionMode="Single" 
                              SelectedItem="{Binding Path=ProductoSeleccionado, Mode=TwoWay}" IsReadOnly="True">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTextColumn Binding="{Binding Path=Nombre}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="100*" Header="Producto" />
                        </sdk:DataGrid.Columns>
                            <i:Interaction.Behaviors>
                                <behaviors:DataGridDoubleClickBehavior
                                        DoubleClickCommand="{Binding Path=BotonActualizarProducto}" 
                                        CommandParameter="{Binding SelectedItem, ElementName=dataGrid1}"/>

                            </i:Interaction.Behaviors>
                            <toolkit:ContextMenuService.ContextMenu>
                                <toolkit:ContextMenu>
                                    <toolkit:MenuItem Header="Eliminar" Command="{Binding Path=BotonEliminarProducto}" />
                                </toolkit:ContextMenu>
                            </toolkit:ContextMenuService.ContextMenu>
                        </sdk:DataGrid>
                        <Button Command="{Binding Path=BotonNuevoProducto}" Content="Nuevo" Height="33" Margin="0,0,228,0" Name="button1" VerticalAlignment="Top" />
                    </Grid>
                </StackPanel>
                    
            </sdk:TabItem>
        </sdk:TabControl>

    </Grid>
</UserControl>
